Method and apparatus for loop breaking on a serial bus

ABSTRACT

A method for loop breaking includes selecting a first port of a node, transmitting a first packet containing a first identifier from the first port of the node, listening for a second packet containing a second identifier for a period of time on a second port of the node, joining the first port and the node if the second identifier meets a first criteria with respect to the first identifier and quarantining the first port when the second identifier meets a second criteria with respect to the first identifier.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to data communications. More particularly, the present invention relates to a method and apparatus for loop breaking on a serial bus.

2. Background

Computer systems and other digital electronic systems often use a common interconnect to share information between components of the system. The interconnect used in such systems is typically a serial bus. The correct operation of any bus requires that there be exactly one path between any two components on the bus.

The IEEE1394-1995 standard defines one type of serial bus. IEEE Standards document 1394-1995, entitled IEEE Standard for a High Performance Serial Bus (hereinafter “IEEE1394-1995 standard”). A typical serial bus having the IEEE1394-1995 standard architecture includes many nodes that are interconnected by links such as cables that connect a single node of the serial bus to another node of the serial bus. Nodes interface to links via one or more ports. Data packets are propagated throughout the serial bus using a number of transactions. These transactions involve one node receiving a packet from another node via one link and retransmitting the received packet to other nodes via other links. A tree network configuration and the associated packet handling protocol ensures that each node receives every packet once.

The IEEE1394-1995 standard provides for an arbitrary acyclic bus topology. Correct operation of the bus relies on the superimposition of a hierarchical relationship which is constrained by the manner in which the nodes are connected to one another. In IEEE1394-1995, this relationship is determined during the bus configuration process.

An IEEE1394-1995 serial bus is configured in three phases: bus initialization, tree identification (tree-ID) and self identification (self-ID). During bus initialization, the general topology information of the serial bus is identified according to a tree metaphor. For example, each node is identified as being either a “branch” having more than one connected ports or a “leaf” having only one connected port. A node recognizes its status as a leaf node or a branch node immediately upon entering tree-ID. During tree identification, hierarchical relationships are established between the nodes. For example, one node is designated a “root” node, and the hierarchy of the remaining nodes is established with respect to the relative nearness of a node to the root node. Given two nodes that are connected to one another, the node connected closer to the root is the “parent” node, and the node connected farther from the root is the “child”. Nodes connected to the root are children of the root. This process of identifying hierarchical relationships continues until the number of children of a node is greater than or equal to one less than the number of connected ports on the node. During self-ID, each node is assigned a bus address and a topology map may be built for the serial bus.

Typically, serial buses such as the IEEE1394-1995 serial bus require knowing what is being plugged in where. For example, the back of many electronic devices has ports for connecting the electronic devices to other electronic devices. Under the IEEE1394-1995 standard, correct bus operation is not possible if electronic devices are connected in a loop configuration. A specific function of the configuration process is therefore to determine whether a loop is present, and if a loop is found to prevent completion of the configuration process, thereby rendering the bus inoperable. The bus is rendered inoperable when a timeout occurs in the configuration process. The devices must be physically reconnected in some other way to remove the loop. The configuration process provides no indication of how to reconnect the bus in order to remove the loop. Consequently, correctly reconnecting the devices requires a detailed understanding of how the devices may properly be connected. Typical users of these devices do not have such an understanding. Thus, devices on a bus may be reconnected many times using a sort of “hit-or-miss” approach before the loop is removed.

Buses such as the IEEE1394-1995 serial bus are being used increasingly to connect products for home use. These products include televisions, stereos and other home entertainment devices. Requiring typical users of such products to know what should be plugged in where is unnecessarily burdensome. Accordingly, a need exists in the prior art for a method and apparatus for loop detection and loop breaking such that devices on a bus remain connected to their neighbors, even in the presence of one or more loops.

BRIEF DESCRIPTION OF THE INVENTION

A method for loop breaking includes selecting a first port of a node, transmitting a first packet containing a first identifier from the first port of the node, listening for a second packet containing a second identifier for a period of time on a second port of the node, joining the first port and the node if the second identifier meets a first criteria with respect to the first identifier and quarantining the first port when the second identifier meets a second criteria with respect to the first identifier. In another aspect, a serial bus includes a plurality of nodes and a plurality of communications links interconnecting the nodes, each communications link being coupled between two nodes in a manner such that each node is coupled to every other node via one or more communications links, wherein at least one of the plurality of nodes includes at least one port coupled to a communications link and operative to transmit and receive data via the communications link, wherein a loop passing through a node is broken by internally isolating at least one port from the node, such that all ports of the node remain connected to their neighbors.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram that illustrates a node according to the present invention.

FIG. 2A is a block diagram that illustrates the tree identification process according to the IEEE1394-1995 Serial Bus Standard.

FIG. 2B is a block diagram that illustrates the tree identification process according to the IEEE1394-1995 Serial Bus Standard in a configuration having a loop.

FIG. 3A is a block diagram that illustrates loop breaking in accordance with one embodiment of the present invention.

FIG. 3B is a block diagram that illustrates loop breaking in accordance with one embodiment of the present invention.

FIG. 3C is a block diagram that illustrates loop breaking in accordance with one embodiment of the present invention.

FIG. 3D is a block diagram that illustrates loop breaking in accordance with one embodiment of the present invention.

FIG. 3E is a block diagram that illustrates loop breaking in accordance with one embodiment of the present invention.

FIG. 4 is a state diagram that illustrates port actions in accordance with one embodiment of the present invention.

FIG. 5 is a flow diagram that illustrates port actions in accordance with one embodiment of the present invention.

FIG. 6 is a flow diagram that illustrates the “Disconnected” state of a port in accordance with one embodiment of the present invention.

FIG. 7 is a flow diagram that illustrates the “Join peer bus as a leaf node” state of a port in accordance with one embodiment of the present invention.

FIG. 8 is a flow diagram that illustrates the “Wait for loop testing” state of a port in accordance with one embodiment of the present invention.

FIG. 9 is a flow diagram that illustrates the “Active port on unified bus” state in accordance with one embodiment of the present invention.

FIG. 10A is a flow diagram that illustrates the “Quarantined” state of a port in accordance with one embodiment of the present invention.

FIG. 10B is a flow diagram that illustrates unquarantining a quarantined port in accordance with one embodiment of the present invention.

FIG. 11 is a detailed state diagram that illustrates the loop detection sequence in accordance with one embodiment of the present invention.

FIG. 12 is a detailed state diagram that illustrates the loop detection sequence in accordance with one embodiment of the present invention.

FIG. 13A is a detailed flow diagram that illustrates the loop detection sequence in accordance with one embodiment of the present invention.

FIG. 13B is a detailed flow diagram that illustrates selecting an untested port in accordance with one embodiment of the present invention.

FIG. 13C is a detailed flow diagram that illustrates arbitrating for loop test in accordance with one embodiment of the present invention.

FIG. 13D is a detailed flow diagram that illustrates sending a loop test packet in accordance with one embodiment of the present invention.

FIG. 13E is a detailed flow diagram that illustrates issuing a random challenge in accordance with one embodiment of the present invention.

FIG. 13F is a detailed flow diagram that illustrates issuing joining a port to bus in accordance with one embodiment of the present invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Those of ordinary skill in the art will realize that the following description of the present invention is illustrative only. Other embodiments of the invention will readily suggest themselves to such skilled persons having the benefit of this disclosure.

This invention relates to data communications. More particularly, the present invention relates to a method and apparatus for loop breaking on a serial bus. The invention further relates to machine readable media on which are stored (1) the layout parameters of the present invention and/or (2) program instructions for using the present invention in performing operations on a computer. Such media includes by way of example magnetic tape, magnetic disks, optically readable media such as CD ROMs and semiconductor memory such as PCMCIA cards. The medium may also take the form of a portable item such as a small disk, diskette or cassette. The medium may also take the form of a larger or immobile item such as a hard disk drive or a computer RAM.

Although the bus architecture described herein is described with reference to components for a single computer, the bus architecture has a broader scope. The bus architecture could include audio and video components, home appliances, positioning and robotic systems, and test and measurement systems, for example. The present invention may be applied to any arbitrarily assembled collection of nodes linked together as a network of devices. In addition, it is necessary to distinguish a node from a physical computer component. Each component to reside on a bus will have with it at least one node physical layer controller. A given component may be associated with multiple nodes. However, there will usually be a one-to-one correspondence between devices or components and nodes on a bus.

According to the IEEE1394-1995 standard, reconfiguration of a serial bus is required when either 1) a new node is joined to the serial bus, or 2) an identified node of the serial bus is removed from the serial bus. Reconfiguration is required to better ensure that all nodes of the serial bus are notified of the newly connected or disconnected node and that each node has a unique bus address.. Typically, the node of the serial bus that detects a new connection or disconnection forces the three phase configuration to be performed by asserting a bus reset signal.

Referring now to FIG. 1, a block diagram of a node 10 is illustrated. In a preferred embodiment, the nodes are designed to be compatible with the IEEE1394-1995 Serial Bus Standard. The node 10 includes state machine logic 12. This state machine logic 12 incorporates all the logic circuitry for carrying out the methodologies and algorithms to be described herein. The circuitry may comprise a programmable logical array (PLA) or be uniquely designed to carry out the functions described herein. Those of ordinary skill in the art, having the benefit of this disclosure, will be able to implement the present invention without undue experimentation. The node 10 is coupled to a local host 14. The local host 14 may be any device one wishes to attach to the bus, such as a disk drive, CPU, keyboard, television, stereo, household appliance, or any other component which needs to communicate with other components in the system. The node 10, by means of its logic, will implement the arbitration protocol including the bus initialization, tree identification and self-identification described above and the loop detecting functions described in detail below.

The node 10 communicates with other nodes through communications links. A link is a connection between two ports. Typically, a cable segment is used for a link. However, a link may be implemented as any physical communication channel, including wireless RF or infrared. A port is the interface between a node and a link. A port has the ability to transmit and receive data. A port can also determine whether it is connected to another port through a link. In FIG. 1, node 10 has three external ports 16, 18 and 20 with connecting links 22, 24 and 26, respectively.

An individual node may have more than one port, and each node is able to transmit and receive data on any one of its ports. A node is also able to receive and transmit signaling messages through all of its ports. In the discussion that follows, devices and local hosts will, for the most part, be omitted and all references to bus topology will refer to nodes and node connections through various ports.

Turning now to FIG. 2A, the tree identification process is illustrated. The tree 30 includes five nodes, labeled A 32, B 34, C 36, D 38 and E 40. Node A 32 has two ports 42 and 44. Node B 34 has two ports 46 and 48. Node C 36 has four ports 50, 52, 54 and 56. Node D 38 has one port 58 and Node E 40 has one port 60. Nodes B 34, D 38 and E 40 are leaf nodes because they have only one connected port. During tree identification, leaf nodes exchange signals with parent nodes to establish the parent-child relationship. Non-leaf nodes must wait until all connected ports but one are designated child ports. Accordingly, Node B 34 sends a “You are my parent” (YAMP) signal to node A 32. Node A 32 responds with a “You are my child” (YAMC) signal. The parent-child relationship between node D 38 and node C 36 and between node E 40 and node C 36 is established in the same way. At this point, all but one port 56 for node C 36 has been designated a child port. Since the other port 56 has not been assigned, it must be connected to a parent node. Node C 36 then establishes node A 32 as its parent and node A 32 establishes node C 36 as its child. Since all connected ports for node A 32 are connected to child nodes, node A 32 is the root node.

Those of ordinary skill in the art will recognize that node C 36 could have been designated the root node in the above example. Whether node A 32 or node C 36 is established as the root node depends upon the timing of the YAMP and YAMC signals. Node A 32 was designated the root node for illustrative purposes.

Turning now to FIG. 2B, the tree identification process is illustrated in a configuration having a loop. FIG. 2B is the same as FIG. 2A, except that port 48 of node B 34 has been connected via link 62 to port 50 of node C 36, creating a loop. Tree identification for leaf nodes D 38 and E 40 proceeds as explained with respect to FIG. 2A. The parent-child relationships between node D 38 and node C 36 and between node E 40 and node C 36 are established. At this point, the tree identification process cannot proceed because node A 32, node B 34 and node C 36 are non-leaf nodes with two unassigned ports. Eventually, the tree-ID process times out and the bus remains inoperable.

According to the present invention, all ports of a node are allowed to remain connected to their neighbors, even in the presence of one or more loops. The present invention minimizes the number of isolated links, thus avoiding breaking a bus into two or more isolated buses. A loop is broken by internally isolating selected ports from the whole of the node. In effect, each port of a loop functions as a naked leaf node. Thus, each port participates fully in bus reset, tree-ID and self-ID.

FIGS. 3A through 3E are block diagrams that illustrate loop breaking in a system comprising a bus compatible with the IEEE1394-1995 standard in accordance with one embodiment of the present invention. In the discussion that follows, nodes will be referred to as PHYs in accordance with the IEEE1394-1995 standard. In FIG. 3A, seven PHYs are represented. Initially, PHY 70 has at most one port 72 attached to its internal state machine. All other ports 76 and 78 are isolated from each other and the combined PHY 70 until they can be tested for loops. These ports appear as naked leaf nodes on the bus to which they are connected. While in this state, each port consumes a PhyID on its attached bus. The PHY 70 has at most one connected port and receives its actual ID 82 from that attached bus 84.

Turning now to FIG. 3B, a block diagram illustrating sending a loop test packet according to one embodiment of the present invention is presented. The main bus 84 is defined as the bus of which the tested and joined ports are members. The peer bus is defined as the bus of which the port under test is a member. The PHY 70 selects one of its untested ports 78, arbitrates for the attached peer bus 86, and begins transmitting a loop test packet (LTP) 88. If the LTP 88 is not received on any other active port attached to the main bus within a period of time, the selected port 78 is free of loops and can be joined to the combined PHY 70. The port 78 may be joined by issuing a bus reset, which will assign new PhyIDs. The joining of the port 78 and the PHY 70 is represented in FIG. 3C. Note the newly assigned PhyIDs.

Turning now to FIG. 3D, a block diagram illustrating loop testing on a port having a loop is presented. After a join, the PHY 70 begins loop testing on the next untested port 76. If the LTP 88 is received on any other active port of the PHY 70, the port 76 is quarantined, as illustrated in FIG. 3E. However, cycle-free ports of the same PHY 70 remain connected to the combined PHY 70. Thus, port 72 remains connected to PHY 70.

Turning now to FIG. 4, a state diagram illustrating port actions in accordance with one embodiment of the present invention is illustrated. Initially, an untested port is in a “Disconnected” state 90. When a connection is detected, a port attempts to join the peer bus, as represented by state 92. If the peer bus fails to complete tree-ID due to an external loop, the port remains unjoined, allowing the remaining joined ports to operate. After joining the peer bus as a leaf node, the port awaits loop testing service at state 94. If no loop is detected, the port joins the main bus at state 96 and remains active as long as no Tree-ID timeout is detected. If a loop is found, the port is quarantined at state 98 until a disconnect event happens. The disconnect event may have removed the loop.

Turning now to FIG. 5, a flow diagram illustrating port actions in accordance with one embodiment of the present invention is illustrated. This figure corresponds to the state diagram illustrated in FIG. 4. At reference numeral 100, an untested port is selected. At reference numeral 102, the port joins the peer bus as a leaf node. At reference numeral 104, the port arbitrates for the peer bus and transmits a loop test packet (TxLTP). At reference numeral 106, a second port listens for a receive loop test packet (RxLTP). The second port has been tested and is active. More than one port may be active at the same time. In this case, all active ports listen for the RxLTP. At reference numeral 108, a check is made to determine whether the RxLTP was received by the second port within a period of time. If the RxLTP was not received within the period of time, the port and the main bus are joined at reference numeral 110. If the RxLTP was received within the period of time, the first port is quarantined at reference numeral 112. At reference numeral 114, a check is made to determine whether other untested ports remain. If more untested ports remain, execution continues at reference numeral 100. This process continues until all ports have been tested for loops.

FIGS. 6-10 are flow diagrams that further illustrate these port actions.

FIG. 6 illustrates the “Disconnected” state of a port in accordance with one embodiment of the present invention. A port is initially not connected to the peer bus. At reference numeral 120, a check is made to determine whether a new connection has been detected. When a new connection has been detected, the port joins the peer bus as a leaf node at reference numeral 122.

FIG. 7 illustrates the “Join peer bus as a leaf node” state of a port in accordance with one embodiment of the present invention. At reference numeral 130, a check is made to determine whether the peer bus has completed tree-ID. When tree-ID has completed, an attempt is made to join the port to the peer bus as a leaf node by completing the Self-ID phase at reference numeral 132. After the port has been joined to the peer bus, the port waits for loop testing service at reference numeral 134.

FIG. 8 illustrates the “Wait for loop testing” state of a port in accordance with one embodiment of the present invention. At reference numeral 140, the port is tested for loops. At reference numeral 142, a check is made to determine whether a loop has been detected within a period of time. At reference numeral 144, the port is quarantined when a loop is detected. At reference numeral 146, the port is activated on a unified bus when a loop is not detected within the period of time.

FIG. 9 illustrates the “Active port on unified bus” state in accordance with one embodiment of the present invention. At reference numeral 150, the port and the main bus are joined. At reference numeral 152, a check is made to determine whether a tree-ID timeout has been detected. If a tree-ID timeout has been detected, the port is no longer associated with the main bus and at reference numeral 154, the port is joined to the peer bus as a leaf node.

FIG. 10A illustrates the “Quarantined” state of a port in accordance with one embodiment of the present invention. At reference numeral 160, a check is made to determine whether a disconnect has been detected on the bus. A disconnect is signaled with a bus reset event. If a disconnect has not been detected, execution continues at reference numeral 160. If a disconnect has been detected, a check is made at reference numeral 161 to determine whether a Tree-ID timeout has occurred. At reference numeral 163, if a Tree-ID timeout has not occurred, the port enters the “wait for loop testing service” state described above. If a tree-ID timeout has occurred, the port is joined to the peer bus as a leaf node at reference numeral 164.

Turning now to FIG. 10B, a method for unquarantining a quarantined port in accordance with one embodiment of the present invention is presented. This embodiment addresses the situation where a previously operational port later becomes inoperative. The port may become inoperative, for example, when a device is physically disconnected or put in a suspend state. At reference numeral 166, a check is made to determine whether an unquarantined port has become inoperative. If the port has not become inoperative, execution continues at reference numeral 169. If the port has become inoperative, a quarantined port is unquarantined at reference numeral 167. At reference numeral 168, a bus reset is issued and the bus is reconfigured, thereby allowing bus operation to continue.

Turning now to FIG. 11, a detailed state diagram illustrating the loop detection sequence in accordance with one embodiment of the present invention is presented. The illustration of this invention with respect to the IEEE1394-1995 standard is not intended to be limiting in any way. Those of ordinary skill in the art will recognize that the invention may be applied to other buses as well.

“Select Next Untested Port” State

At reference numeral 170, the next untested port is selected. According to a preferred embodiment, ports associated with higher speed connections are chosen before lower speed connections. Those of ordinary skill in the art will recognize that selecting ports in this way increases the likelihood of “removing” the lowest speed cable in the event a loop is detected. While the cable or other physical connection itself is not removed, the loop created by a cable is broken by isolating the particular port involved in the loop.

“Arbitrate for Loop Test” State

At reference numeral 172, the PHY initiates arbitration for one or both of the buses required to perform loop testing. According to one embodiment of the present invention, if both the main and peer buses are multi-node buses, arbitration is initiated simultaneously on both buses and the loop testing is initiated on the first bus to be granted. If one bus is a single node bus and the other is a multi-node bus, arbitration is performed on the multi-node bus first. If both buses are single node buses, arbitration begins on both and loop testing is initiated on the first bus granted. This process of performing arbitration on multiple buses simultaneously reduces the probability of requiring a relatively long bus reset when joining ports to a PHY.

Send Loop Test Packet State

At reference numeral 174, the PHY transmits a loop test packet including a unique identifier. The transmitted identifier is denoted “TxLTP”. While transmitting the LTP, the PHY listens for any packet received on the main bus or the peer bus within a period of time. The received identifier is denoted “RxLTP”.

According to one embodiment of the present invention, the identifier includes the PHY ID and port ID of the transmitting port, the PHY ID and port ID of the receiving port, the speed of the untested port and a Globally Unique Identifier (GUID). According to another embodiment of the present invention, the identifier includes the PHY ID and port ID of the transmitting port, the PHY ID and port ID of the receiving port, the speed of the untested port and a random number.

The discussion of particular unique identifiers is not intended to be limiting in any way. Those of ordinary skill in the art will recognize there are many other ways of forming unique identifiers. These other ways of forming unique identifiers may include, for example, other combinations of the PHY ID and port ID of the transmitting port, the PHY ID and port ID of the receiving port, the speed of the untested port, a Globally Unique Identifier (GUID) and a random number.

The identifier is used to determine if a particular LTP was sent by the local PHY or by another PHY in the network. Additionally, the identifier prevents two or more PHYs from simultaneously joining ports, thus creating a loop. A loop is avoided by using a predetermined criteria and the unique identifiers from multiple PHYs to establish a “winning” PHY and “losing” PHY(s). Since more than two PHYs could be performing loop testing simultaneously, there could be more than one “losing” PHY. The winning PHY joins the port to the main bus, while the losing PHY(s) surrender the buses. The PHY waits at least a subaction gap (as defined by the IEEE1394-1995 standard) after sending a LTP. If the PHY has either not seen a RxLTP or has received one with a lower ID, a loop does not exist and the port can be safely joined to the main bus.

Join State

At reference numeral 176, the port under test is joined to the main bus. According to a preferred embodiment of the present invention, the port is joined by first waiting a period of time for the PHY to win arbitration of both the main bus and the peer bus. If arbitration of both buses is won within the period of time, a relatively short bus reset is issued. If arbitration of both buses is not won within the period of time, a relatively long bus reset is issued. After the port has been joined, the next untested port is selected and tested for loops.

Surrender State

The surrender state is indicated by reference numeral 178. To prevent both PHYs from joining simultaneously, the PHY with the lower ID surrenders and waits until the receiving bus returns to idle, which may occur after a bus reset used by the winning PHY to join a port. Once the port surrenders the buses, the next untested port is selected and tested for loops.

Issue Random Challenge State

At reference numeral 180, the PHY has received the same identifier as the one transmitted. Consequently, a loop may exist. Alternatively, another PHY may have chosen the same ID. At reference numeral 180, the LTP is modified to include a random number to reduce the risk of a false loop detection in the case where two PHYs use the same initial identifier. The modified packet is sent and the same criteria used in the “Send Loop Test Packet” state 174 is used to determine whether to surrender bus control, or to join the port to the main bus.

According to another embodiment of the present invention, the original LTP is modified to include a random challenge, thus requiring only one loop test per port. This embodiment is illustrated in FIG. 12.

Quarantined State

At reference numeral 182, if the PHY received the same identifier as the one it transmitted, a loop exists and the port is quarantined. Once the port is quarantined, the next untested port is selected and tested for loops. This process continues until all ports of the PHY have been tested.

The criteria used to determine what action to take based upon a comparison of a TxLTP and a RxLTP is not intended to be limiting in any way. Those of ordinary skill in the art will recognize that other criteria may be used. For example, a port might be joined if a first criteria is met with respect to the TxLTP and the RxLTP. A port might surrender the buses if a second criteria is met with respect to the TxLTP and the RxLTP. Also, the decision to issue a random challenge or to quarantine the bus may be based on third criteria with respect to the TxLTP and the RxLTP. This third criteria may include determining whether the packets are equivalent, meaning the same or similar.

To aid in an understanding of the present invention, flow diagram representations of the state diagram in FIG. 11 are now presented. FIGS. 13A-13E further illustrate loop detection in accordance with one embodiment of the present invention.

Turning now to FIG. 13A, a detailed flow diagram illustrating loop detection in accordance with the present invention is presented. At reference numeral 190, the next untested port is selected. At reference numeral 192, the PHY arbitrates for loop test. At reference numeral 194, a loop test packet containing a unique identifier is sent. At reference numeral 196, the unique identifiers in the TxLTP and the RxLTP are compared. If the unique identifier in the RxLTP is less than the unique identifier in the TxLTP or if the RxLTP is not received within a period of time, the port is joined to the main bus at reference numeral 198 and testing of the next port is initiated at reference numeral 190. If the unique identifier in the RxLTP is greater than or equal to the unique identifier in the TxLTP, the unique identifiers are compared again at reference numeral 200. If the unique identifier in the RxLTP is greater than the unique identifier in the TxLTP, the PHY surrenders control of the buses at reference numeral 202 and testing of the next port is initiated at reference numeral 190.

If the RxLTP is equal to the TxLTP, a random challenge is issued at reference numeral 204. At reference numerals 206 and 208, the RxLTP and the TxLTP are compared as was done at reference numerals 196 and 200. If the unique identifier in the RxLTP is less than the unique identifier in the TxLTP or if the RxLTP was not received within a period of time, the port is joined to the main bus at reference numeral 210 and testing of the next port is initiated at reference numeral 190. If the unique identifier in the RxLTP is greater than the unique identifier in the TxLTP, the PHY surrenders control of the buses at reference numeral 212 and testing of the next port is initiated at reference numeral 190. If the RxLTP is equal to the TxLTP, the port is quarantined at reference numeral 214 and testing of the next port is initiated at reference numeral 190.

Referring now to FIG. 13B, a flow diagram illustrating selecting an untested port in accordance with one embodiment of the present invention is presented. At reference numeral 220, an untested port is selected. Since a leaf node cannot be part of a loop, the first connected port of a PHY may bypass loop testing and join the main bus immediately. At reference numeral 222, a check is made to determine whether the number of joined ports is zero. If the number of joined ports is zero, the port and the main bus are joined at reference numeral 224. If the number of joined ports is not zero, arbitration for loop test is performed at reference numeral 226.

Referring now to FIG. 13C, a flow diagram illustrating arbitrating for loop test in accordance with one embodiment of the present invention is presented. According to one embodiment of the present invention, arbitration for the main bus is initiated at reference numeral 230. As discussed above, arbitration for the main bus is performed to allow a short bus reset for joining the port to the main bus. At reference numeral 232, arbitration for the peer bus is initiated. At reference numeral 234, a loop test packet is sent on whatever bus is granted first. The order of reference numerals 232 and 230 is not important. Arbitration may be initiated for both buses in series, or arbitration may be initiated for both buses in parallel.

Referring now to FIG. 13D, a flow diagram illustrating sending a loop test packet in accordance with one embodiment of the present invention is presented. If arbitration for the main bus was granted first, a loop test packet is sent from a tested port connected to the main bus. If arbitration for the peer bus was granted first, a loop test packet is sent from the port under test, which is connected to the peer bus. To prevent obsfucation of the present invention, the following disclosure will refer to the case in which arbitration on the peer bus is granted first. However, those of ordinary skill in the art will recognize that the embodiments of the present invention disclosed herein may apply to the case in which arbitration for the main bus is granted first, in which case the loop test packet sending and receiving roles of the port under test and an active port are reversed.

At reference numeral 240, a loop test packet is sent on the peer bus. At reference numeral 242, the PHY listens for packets received by any port connected to the main bus. The packets are compared as discussed with respect to FIG. 13A, above.

Referring now to FIG. 13E, a flow diagram illustrating issuing a random challenge in accordance with one embodiment of the present invention is presented. At reference numeral 260, the loop test packet is modified to include random data. At reference numeral 262, the modified loop test packet is sent on the peer bus. At reference numeral 264, packets received by the port connected to the main bus are monitored. The packets are compared as discussed with respect to FIG. 13A, above. If the packets are equivalent, a loop exists and the port is quarantined at reference numeral 274. The next port is then selected for loop testing. This process continues until all ports have been tested for loops.

Referring now to FIG. 13F, a flow diagram illustrating joining a port to the main bus in accordance with one embodiment of the present invention is presented. At reference numeral 280, a check is made to determine whether arbitration for both the main bus and the peer bus has been won. If arbitration for both buses has been won, a relatively short bus reset is issued at reference numeral 282. If arbitration for both buses has not been won, a check is made at reference numeral 284 to determine whether a period of time has elapsed since beginning the Join process. If the period of time has not elapsed, execution continues at reference numeral 280. If the period of time has elapsed, a relatively long bus reset is issued at reference numeral 286.

As discussed above with reference to FIG. 13D, many other embodiments of the present invention are possible when the roles of the sending and receiving ports are reversed. Arbitration for the main bus is granted first. A first port that is active (has been tested, found free of loops and joined to a PHY), sends the loop test packet containing a first unique identifier. A second port that has not been tested and is from the same node as the first port listens for a packet containing a second unique identifier. If a first criteria is met with respect to the first and second identifiers, or if a loop test packet is not received within a period of time, the second port may be joined with the node. If a second criteria is met with respect to the first and second identifiers, the second port is quarantined.

According to a presently preferred embodiment, the present invention may be implemented in software or firmware, as well as in programmable gate array devices, Application Specific Integrated Circuits (ASICs), and other hardware.

ALTERNATIVE EMBODIMENTS

Thus, a novel method and apparatus for loop detection on a serial bus has been described. While embodiments and applications of this invention have been shown and described, it would be apparent to those skilled in the art having the benefit of this disclosure that many more modifications than mentioned above are possible without departing from the inventive concepts herein. The invention, therefore, is not to be restricted except in the spirit of the appended claims. 

What is claimed is:
 1. In an electronics system including at least one bus, each said bus including at least one node, each said node including at least one port, a method for loop breaking, said method comprising: selecting a first port of a node; transmitting a first packet on a bus attached to said first port of said node, said first packet containing a unique identifier; listening for a second packet for a period of time on a second port of said node, said second packet containing said unique identifier; joining said first port to said node if said second packet is not received within said period of time; and quarantining said first port if said second packet is received within said period of time.
 2. In an electronics system including at least one bus, each said bus including at least one node, each said node including at least one port, a method for loop breaking, said method comprising: selecting a first port of a node, said first port operatively coupled to a first bus and a node; transmitting a first packet on said first bus from said first port of said node, said first packet containing a unique identifier; listening for a second packet for a period of time on a second port of said node, said second port operatively coupled to a second bus, said second port not operatively coupled to said node, said second packet containing said unique identifier; joining said second port to said node if said second packet is not received within said period of time; and quarantining said second port if said second packet is received within said period of time.
 3. The method of claim 1, further comprising unquarantining a quarantined port if an unquarantined port is rendered inoperative.
 4. The method of claim 1, further comprising determining whether other ports of said node have been tested for loops.
 5. The method of claim 4 wherein said bus is compatible with the IEEE1394-1995 standard; and said method further comprises: resuming loop testing if a bus disconnect is detected; removing said first port from said bus if a tree-ID timeout is detected; and attempting to join said first port to said bus if a tree-ID timeout is detected.
 6. In an electronics system including at least one bus, each said bus including at least one node, each said node including at least one port, a method for loop breaking, comprising: selecting a first port of a node, said first port operatively coupled to a first bus; transmitting a first packet on said first bus from said first port of said node, said first packet including a first identifier; listening for a second packet for a first amount of time on a second port of said node, said second packet including a second identifier; joining said first port and said node if said second identifier meets a first criteria with respect to said first identifier; surrendering control of said first bus if said second identifier meets a second criteria with respect to said first identifier; and quarantining said first port if said second identifier meets a third criteria with respect to said first identifier.
 7. The method of claim 6 wherein said first criteria is met if said second identifier is less than said first identifier; said second criteria is met if said second identifier is greater than said first identifier; and said third criteria is met if said second identifier is equivalent to said first identifier.
 8. In an electronics system including at least two buses, each of said two buses including at least one node, each said node including at least one port, a method for loop breaking, comprising: selecting a first port of a node, said first port operatively coupled to a first bus; transmitting a first packet on said first bus from said first port of said node; listening for a second packet for a first amount of time on a second port of said node, said second port operatively coupled to a second bus; joining said first port to said node if said second packet meets a first criteria with respect to said first packet; surrendering control of said first bus if said second packet meets a second criteria with respect to said first packet; transmitting a third packet on said first bus from said first port of said node if said second packet meets a third criteria with respect to said first packet; listening for a fourth packet for a second amount of time on said second port of said node; joining said first port to said node if said fourth packet meets a fourth criteria with respect to said third packet; surrendering control of said first bus if said fourth packet meets a fifth criteria with respect to said third packet; and quarantining said first port if said fourth packet meets a sixth criteria with respect to said third packet.
 9. The method of claim 8 wherein joining said first port to said node comprises: initiating arbitration for said first bus and said second bus; issuing a relatively short bus reset if arbitration of said first bus and said second bus is won before a period of time has elapsed; and issuing a relatively long bus reset if arbitration of said first bus and said second bus is not won before said period of time has elapsed.
 10. The method of claim 9 wherein said selecting comprises: determining the number of ports that have been joined; and choosing a first port to be tested for loops if at least one other port has been joined.
 11. The method of claim 10 wherein each of said first packet, said second packet, said third packet and said fourth packet includes a unique identifier.
 12. The method of claim 11 wherein each unique identifier comprises a node ID and a port ID of the transmitting port, a node ID and port ID of the receiving port, the speed of the untested port and a GUID.
 13. The method of claim 11 wherein each unique identifier comprises a node ID and a port ID of the first port, a node ID and port ID of the second port, the speed of the first port and a random number.
 14. The method of claim 9 wherein said arbitrating further comprises: initiating arbitration simultaneously on said first bus and said second bus if both said first bus and said second bus are multi-node buses; initiating arbitration on the multi-node bus before initiating arbitration on a single-node bus if one of said first bus and said second bus is a multi-node bus and the other bus is a single-node bus; initiating arbitration simultaneously on said first bus and said second bus if both said first bus and said second bus are single-node buses; and said method further comprises initiating loop testing on whatever bus is granted arbitration first.
 15. The method of claim 9 wherein said selecting further comprises choosing the untested port attached to the bus having the highest speed with respect to other buses attached to untested ports.
 16. The method of claim 9 wherein said first criteria is met if said second packet is less than said first packet; said second criteria is met if said second packet is greater than said first packet; said third criteria is met if said second packet is equivalent to said first packet; said fourth criteria is met if said fourth packet is less than said third packet; said fifth criteria is met if said fourth packet is greater than said third packet; and said sixth criteria is met if said fourth packet is equivalent to said third packet.
 17. In an electronics system comprising a plurality of components interconnected by a plurality of communication links, said plurality of components each having at least a first communications node wherein said communications nodes interface their associated component with a communications link through a port, said nodes being capable of having a plurality of ports to which communications links to adjacent nodes couple, each node having a predetermined selection criteria established for selecting adjacent nodes coupled through its ports, said configuration of nodes and communications links comprising one node that is designated a root node, all nodes coupled to only one adjacent node are designated leaf nodes, all other nodes in the configuration being designated branch nodes, said nodes having established hierarchical parent-child relationships between all adjacent nodes proceeding from the root node down to any leaf nodes wherein a leaf node has only one parent node and all nodes adjacent to the root node are child nodes with respect to the root node but parent nodes with respect to the other nodes, the root node being defined as having no parent node, a method of loop breaking, comprising: selecting a first port of a node; joining said first port to a communications link attached to said first port of said node; transmitting a first packet on said communications link from said first port of said node, said first packet containing a unique identifier; listening for a second packet for a first amount of time on a second port of said node, said second packet containing a unique identifier; joining said first port to said node if said second packet is not received within said first amount of time; and quarantining said first port if said second packet is received within said first amount of time.
 18. The method of claim 17, further comprising determining whether other ports of said node have been tested for loops.
 19. In an electronic system, a method for loop breaking on a serial bus compatible with the IEEE1394-1995 standard, the method comprising: selecting a first port of a node; joining said first port to a bus attached to said first port of said node; transmitting a first packet on the bus from said first port of said node, said first packet containing a unique identifier; listening for a second packet for a first amount of time on a second port of said node, said second packet containing a unique identifier; joining said first port to said node if said second packet is not received within said first amount of time; and quarantining said first port if said second packet is received within said first amount of time.
 20. A serial bus compatible with the IEEE1394-1995 standard and comprising: a plurality of nodes; and a plurality of communications links interconnecting the nodes, wherein a loop passing through a node is broken by internally isolating at least one port from said node, such that all ports of said node remain connected to their neighbors.
 21. A serial bus comprising: a plurality of nodes; and a plurality of communications links interconnecting the nodes, each communications link being coupled between two nodes in a manner such that each node is coupled to every other node via one or more communications links, wherein at least one of said plurality of nodes comprises: at least one port coupled to a communications link and operative to transmit and receive data via the communications link, wherein a loop passing through a node is broken by internally isolating at least one port from the node, such that all ports of the node remain connected to their neighbors.
 22. A program storage device readable by a machine, tangibly embodying a program of instructions executable by the machine to break loops in an electronics system including at least one bus, each bus including at least one node, each node including at least one port, the program storage device comprising: code for causing a machine to select a first port of a node, said first port operatively coupled to a first bus and a node; code for causing a machine to transmit a first packet on said first bus from said first port of said node, said first packet containing a unique identifier; code for causing a machine to listen for a second packet for a period of time on a second port of said node, said second packet operatively coupled to said node, said second packet containing said unique identifier; code for causing a machine to join said first port to said node if said second packet is not received within said period of time; and code for causing a machine to quarantine said second port if said second packet is received within said period of time.
 23. A program storage device readable by a machine, tangibly embodying a program of instructions executable by the machine to break loops in an electronics system including at least one bus, each bus including at least one node, each node including at least one port, the program storage device comprising: code for causing a machine to select a first port of a node, said first port operatively coupled to a first bus and a node; code for causing a machine to transmit a first packet on said first bus from said first port of said node, said first packet containing a unique identifier; code for causing a machine to listen for a second packet for a period of time on a second port of said node, said second port operatively coupled to a second bus, said second port not operatively coupled to said node, said second packet containing said unique identifier; code for causing a machine to join said second port to said node if said second packet is not received within said period of time; and code for causing a machine to quarantine said second port if said second packet is received within said period of time.
 24. A program storage device readable by a machine, tangibly embodying a program instructions executable by the machine to break loops in an electronics system including at least one bus, each bus including at least one node, each node including at least one port, the program storage device comprising: code for causing a machine to select a first port of a node, said first port operatively coupled to a first bus; code for causing a machine to transmit a first packet on said first bus from said first port of said node; code for causing a machine to listen for a second packet for a first amount of time on a second port of said node, said second packet including a second identifier; code for causing a machine to join said first port and said node if said second identifier meets a first criteria with respect to said first identifier; code for causing a machine to surrender control of said second bus if said second identifier meets a second criteria with respect to said first identifier; and code for causing a machine to quarantine said first port if said second identifier meets a third criteria with respect to said first identifier.
 25. A program storage device readable by a machine, tangibly embodying a program of instructions executable by the machine to break loops in an electronics system including at least one bus, each bus including at least one node, each node including at least one port, the program storage device comprising: code for causing a machine to select a first port of a node, said first port operatively coupled to a first bus; code for causing a machine to transmit a first packet on said first bus from said first port of said node; code for causing a machine to listen for a second packet for a first amount of time on a second port of said node; code for causing a machine to join said first port and said node if said second packet meets a first criteria with respect to said first packet; code for causing a machine to surrender control of said second bus if said second packet meets a second criteria with respect to said first packet; code for causing a machine to transmit a third packet on said first bus from said first port of said node if said second packet meets a third criteria with respect to said first packet; code for causing a machine to listen for a fourth packet for a second amount of time on said second port of said node; code for causing a machine to join said first port and said node if said fourth packet meets a fourth criteria with respect to said third packet; code for causing a machine to surrender control of said second bus if said fourth packet meets a fifth criteria with respect to said third packet; and code for causing a machine to quarantine said first port if said fourth packet meets a sixth criteria with respect to said third packet.
 26. A program storage device readable by a machine, tangibly embodying a program of instructions executable by the machine to break loops in an electronics system comprising a plurality of components interconnected by a plurality of communication links, said plurality of components each having at least a first communications node wherein said communications nodes interface their associated component with a communications link through a port, said nodes being capable of having a plurality of ports to which communications links to adjacent nodes couple, each node having a predetermined selection criteria established for selecting adjacent nodes coupled through its ports, said configuration of nodes and communications links comprising one node that is designated a root node, all nodes coupled to only one adjacent node are designated leaf nodes, all other nodes in the graph being designated branch nodes, said nodes having established hierarchical parent child relationships between all adjacent nodes proceeding from the root node down to any leaf nodes wherein a leaf node has only one parent node and all nodes adjacent to the root node are child nodes with respect to the root node but parent nodes with respect to the other nodes, the root node being defined as having no parent node, the program storage device comprising: code for causing a machine to select a first port of a node; code for causing a machine to transmit a first packet on said communications link from said first port of said node; code for causing a machine to listen for a second packet for a first amount of time on a second port of said node; code for causing a machine to join said first port to said node if said second packet is not received within said first amount of time; and code for causing a machine to quarantine said first port if said second packet is received within said first amount of time.
 27. A program storage device readable by a machine, tangibly embodying a program of instructions executable by the machine to break loops in an electronic system, a method for loop breaking on a serial bus compatible with the EEEE1394-1995 standard, the program storage device comprising: code for causing a machine to select a first port of a node; code for causing a machine to transmit a first packet on the bus from said first port of said node; code for causing a machine to listen for a second packet for first amount of time on a second port of said node, said second packet containing a unique identifier; a fourth module comprising code for causing a machine to join said first port to said node if said second packet is not received within said first amount of time; and a fifth module comprising code for causing a machine to quarantine said first port if said second packet is received within said first amount of time.
 28. An electronic device having a serial bus for interconnecting said device with another device, said bus comprising: means for selecting a first port of a node; means for transmitting a first packet on a bus attached to said first port of said node, said first packet containing a unique identifier; means for listening for a second packet for a period of time on a second port of said node, said second packet containing said unique identifier; means for joining said first port to said node if said second packet is not received within said period of time; and means for quarantining said first port if said second packet is received within said period of time.
 29. An electronic device having a serial bus for interconnecting said device with another device, said bus comprising: means for selecting a first port of a node, said first port operatively coupled to a first bus and a node; means for transmitting a first packet on said first bus from said first port of said node, said first packet containing a unique identifier; means for listening for a second packet for a period of time on a second port of said node, said second port operatively coupled to a second bus, said second port not operatively coupled to said node, said second packet containing said unique identifier; means for joining said second port to said node if said second packet is not received within said period of time; and means for quarantining said second port if said second packet is received within said period of time. 